package realm.inorder.itmill;

import javax.servlet.ServletContext;

import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import realm.inorder.itmill.ui.window.MainWindow;

public class Application extends com.itmill.toolkit.Application {

	@Override
	public void init() {
		setTheme("inorder");
		
		ServletContext servletContext = ((com.itmill.toolkit.terminal.gwt.server.WebApplicationContext) this.getContext()).getHttpSession().getServletContext();
		
		WebApplicationContext applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
		MainWindow mainWindow = (MainWindow) BeanFactoryUtils.beanOfType(applicationContext, MainWindow.class);
		this.setMainWindow(mainWindow);
		mainWindow.init();
	}
	 
}
